<template>

    <div class="header-container">
        <div class="left-content">
            <el-button @click="menuButton()" class="botton-left" icon="el-icon-menu" size="mini"></el-button>
            <!-- 面包屑 -->
            <el-breadcrumb separator="/">
                <el-breadcrumb-item v-for="item in tags" :key="item.path" :to="{ path: item.path }">{{ item.label
                    }}</el-breadcrumb-item>
            </el-breadcrumb>
        </div>
        <div class="right-content">
            <el-dropdown>
                <span class="el-dropdown-link">
                    <img class="dropdown-img" src="../assets/logo.png" alt="">
                </span>
                <el-dropdown-menu slot="dropdown">
                    <el-dropdown-item>个人中心</el-dropdown-item>
                    <el-dropdown-item>退出</el-dropdown-item>
                </el-dropdown-menu>
            </el-dropdown>
        </div>
    </div>

</template>

<script>
// 要使用 mapState，你首先需要从 vuex 中导入它。
// 然后，在你的 Vue 组件中，你可以在计算属性（computed）部分使用它。
// mapState 函数可以接收一个字符串数组或是一个对象作为参数，
// 以决定如何映射 state 到计算属性。
import { mapState } from 'vuex';

export default {
    data() {
        return {}
    },
    methods: {
        menuButton() {
            this.$store.commit('collapseMenu')
        }
    },
    computed: {
        ...mapState({
            tags: state => state.tab.tabList
        })
    },
    mounted() {
        // 打印
        // console.log(this.tags, 'tags');

    }

}
</script>
<style>
.header-container {
    padding: 0 20px;
    background-color: #333;
    height: 60px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.left-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.botton-left {
    margin-right: 10px;
}

.left-content-text {
    color: #fff;
    margin-left: 10px;
}

.dropdown-img {
    width: 40px;
    height: 40px;
}

.el-header {
    padding: 0;
}

.el-button:focus,
.el-button:hover {
    color: #000000;
    border-color: #c6fafff7;
    background-color: #ecf5ff;
}


.el-breadcrumb__inner a,
.el-breadcrumb__inner.is-link {
    font-weight: 700;
    text-decoration: none;
    transition: color .2s cubic-bezier(.645, .045, .355, 1);
    color: #666;
}

.el-breadcrumb__inner a:hover,
.el-breadcrumb__inner.is-link:hover {
    color: #ffff;
    cursor: pointer;
}
</style>